import React, { Component } from 'react'
import { connect } from 'react-redux'
import { actionsJia, actionsJian,asyncJia } from "../../reducers/count/actions"
import { Button } from 'antd';
import { SearchOutlined } from '@ant-design/icons';
class Classity extends Component {
  jia=()=>{
    let {actionsJia} = this.props;
    actionsJia(1)
  }
  jian=()=>{
    let {actionsJian} = this.props;
    actionsJian(1)
  }
  asyJia=()=>{
    let {asyncJia} = this.props;
    asyncJia(1)
  }
  render() {
    let { count } = this.props
    return (
      <div>
        Classity
        <div>
        <div>
          count:{count.sum}
        </div>
        <div>
          <Button type="primary" onClick={this.jia}>+</Button>
          <Button type="primary" onClick={this.jian}>-</Button>
          <Button type="primary" onClick={this.asyJia}>异步+</Button>
          <Button type="primary" shape="circle" icon={<SearchOutlined />} />
        </div>
      </div>
      </div>
    )
  }
}



const mapStateToProps = (state) => ({
  count:state.count
})

const mapDispatchToProps = {
  actionsJia,
  actionsJian,
  asyncJia
}

export default connect(mapStateToProps, mapDispatchToProps)(Classity)
